package cn.hnwlgc.service.impl;

import cn.hnwlgc.mapper.PostMapper;
import cn.hnwlgc.pojo.Post;
import cn.hnwlgc.pojo.PostDto;
import cn.hnwlgc.service.PostService;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;
import java.util.List;

@Service
public class PostServiceImpl implements PostService {

    @Autowired
    private PostMapper postMapper;

    @Override
    public void add(Post post) {
        post.setCreateTime(LocalDateTime.now());
        post.setUpdateTime(LocalDateTime.now());
        postMapper.insert(post);
    }

    @Override
    public List<PostDto> list() {
        return postMapper.listDto();
    }
}
